package com.niknik.woody.rest.response;

import com.niknik.woody.core.room.GameEx;
import com.niknik.woody.rest.schema.RespMsg;
import com.niknik.woody.rest.schema.RespStatus;

import javax.xml.bind.annotation.XmlRootElement;

/**
 * User: niknik
 * Date: 1/25/11
 * Time: 10:15 PM
 */
@XmlRootElement
public class WResponse {

  private Integer statusCode;
  private Integer msgCode;

  public WResponse() {
    this(RespStatus.SUCCESS, RespMsg.SUCCESS);
  }

  public WResponse(GameEx ex) {
    this.statusCode = (ex.isFatal()
        ? RespStatus.FATAL
        : RespStatus.ERR).getCode();
    this.msgCode = ex.getMsgCode();
  }

  public WResponse(RespStatus status, RespMsg msgCode) {
    this.statusCode = status.getCode();
    this.msgCode = msgCode.getCode();
  }

  public Integer getStatusCode() {
    return statusCode;
  }

  public void setStatusCode(Integer statusCode) {
    this.statusCode = statusCode;
  }

  public Integer getMsgCode() {
    return msgCode;
  }

  public void setMsgCode(Integer msgCode) {
    this.msgCode = msgCode;
  }
}